package rickyGame.game.property
{
	import ricky.game.Actor;
	
	import rickyGame.game.Player;
	import rickyGame.game.property.property.AgileValue;
	import rickyGame.game.property.property.CalValue;
	import rickyGame.net.MsgType;
	import rickyGame.net.WorkQueue;

	/**
	 * 玩家属性
	 * 用于战斗计算
	 */
	public dynamic class FightPro
	{
		public function FightPro(actor:Actor)
		{
			_actor=actor;
			
			_hp=new AgileValue();			
			_mp=new AgileValue();
		}

		///////////////////////////////////////
		//基本属性
		//////////////////////////////////////
		
		/**
		 * 力量
		 */
		public var power:CalValue=new CalValue();
		
		/**
		 * 魔力
		 */
		public var magic:CalValue=new CalValue();
		
		/**
		 * 敏捷
		 */
		public var nimble:CalValue=new CalValue();
		
		/**
		 * 体质
		 */
		public var physique:CalValue=new CalValue();
			
		
		///////////////////////////////////////////////////////////
		//战斗属性
		//////////////////////////////////////////////////////////
		private var _physicalShun:CalValue=new CalValue();
		
		private var _magicShun:CalValue=new CalValue();
		
		private var _physicalAttack:CalValue=new CalValue();
		
		private var _magicAttack:CalValue=new CalValue();
		
		private var _hp:AgileValue;
		
		private var _mp:AgileValue;
		
		private var _fiercely:CalValue=new CalValue(.2);
		
		private var _block:CalValue=new CalValue();
		
		private var _hit:CalValue=new CalValue(.5);
		
		private var _attackSpeed:CalValue=new CalValue();
		
		private var _physicalDefense:CalValue=new CalValue();
		
		private var _magicDefense:CalValue=new CalValue();
		
		private var _withstand:CalValue=new CalValue();
		
		private var _miss:CalValue=new CalValue();
		
		private var _fiercelyUpper:CalValue=new CalValue(1);
		
		private var _armorRate:CalValue=new CalValue();
		
		
		/**
		 * 根据等级计算属性
		 */
		public function load(level:int):void
		{
			//基础属性
			this.level=level;
			power.setValue(5*level);
			physique.setValue(3*level);
			nimble.setValue(2*level);
			magic.setValue(5*level);
			
			block.setValue(2*level);
			fiercely.setValue(5);
			hit.setValue(60);
			this.magicAttack.setValue(level*5);
			this.magicDefense.setValue(level*2);
			this.magicShun.setValue(level*1);
			mp.base=50*level;
			hp.base=50*level;
				
			mp.agileValue=40*level+80;
			hp.agileValue=40*level+80;
			
		}
		
		/**
		 * 物理躲避 0-1之间 0-100%
		 */
		public function get physicalShun():CalValue
		{
			return _physicalShun;
		}

		/**
		 * @private
		 */
		public function set physicalShun(value:CalValue):void
		{
			_physicalShun = value;
		}

		/**
		 * 魔法躲避 0-1之间 0-100%
		 */
		public function get magicShun():CalValue
		{
			return _magicShun;
		}

		/**
		 * @private
		 */
		public function set magicShun(value:CalValue):void
		{
			_magicShun = value;
		}

		/**
		 * 物理攻击值
		 */
		public function get physicalAttack():CalValue
		{
			_physicalAttack.base=this.power.value;
			return _physicalAttack;
		}

		/**
		 * @private
		 */
		public function set physicalAttack(value:CalValue):void
		{
			_physicalAttack = value;
		}

		/**
		 * 魔法攻击值
		 */
		public function get magicAttack():CalValue
		{
			_magicAttack.base=this.magic.value;
			return _magicAttack;
		}

		/**
		 * @private
		 */
		public function set magicAttack(value:CalValue):void
		{
			_magicAttack = value;
		}

		/**
		 * 血
		 */
		public function get hp():AgileValue
		{
			_hp.base=this.physique.value*5;
			return _hp;
		}

		/**
		 * @private
		 */
		public function set hp(value:AgileValue):void
		{
			_hp = value;
		}

		/**
		 * 蓝
		 */
		public function get mp():AgileValue
		{
			_mp.base=this.magic.value*5;
			return _mp;
		}

		/**
		 * @private
		 */
		public function set mp(value:AgileValue):void
		{
			_mp = value;
		}

		/**
		 * 暴击 0-100%
		 */
		public function get fiercely():CalValue
		{
			return _fiercely;
		}

		/**
		 * @private
		 */
		public function set fiercely(value:CalValue):void
		{
			_fiercely = value;
		}

		/**
		 * 格挡：</br>
		 * 利用武器或其他工具阻挡敌人的攻击，使自身不受伤害或减少伤害的行为。 
		 * 伤害1-目标格挡值
		 */
		public function get block():CalValue
		{
			return _block;
		}

		/**
		 * @private
		 */
		public function set block(value:CalValue):void
		{
			_block = value;
		}

		/**
		 * 命中率
		 * 1-100%
		 */
		public function get hit():CalValue
		{
			return _hit;
		}

		/**
		 * @private
		 */
		public function set hit(value:CalValue):void
		{
			_hit = value;
		}

		/**
		 * 关联对象
		 */
		public function get actor():Actor
		{
			return _actor;
		}

		public function set actor(value:Actor):void
		{
			_actor = value;
		}

		/**
		 * 攻击速度
		 */
		public function get attackSpeed():CalValue
		{
			return _attackSpeed;
		}

		/**
		 * @private
		 */
		public function set attackSpeed(value:CalValue):void
		{
			_attackSpeed = value;
		}

		/**
		 * 物理防御值
		 */
		public function get physicalDefense():CalValue
		{
			return _physicalDefense;
		}

		/**
		 * @private
		 */
		public function set physicalDefense(value:CalValue):void
		{
			_physicalDefense = value;
		}

		/**
		 * 魔法抵抗值 0-100%
		 */
		public function get magicDefense():CalValue
		{
			return _magicDefense;
		}

		/**
		 * @private
		 */
		public function set magicDefense(value:CalValue):void
		{
			_magicDefense = value;
		}

		/**
		 * 招架 0-100%</br>
		 * 消除一次来自角色正面或侧面的物理打击，并重置你的近战自动攻击时间。
		 * 比miss多了个功能恢复cd时间
		 */
		public function get withstand():CalValue
		{
			return _withstand;
		}

		/**
		 * @private
		 */
		public function set withstand(value:CalValue):void
		{
			_withstand = value;
		}

		/**
		 * 未命中值0-100%
		 */
		public function get miss():CalValue
		{
			return _miss;
		}

		/**
		 * @private
		 */
		public function set miss(value:CalValue):void
		{
			_miss = value;
		}

		/**
		 * 暴击上限 >1的数
		 */
		public function get fiercelyUpper():CalValue
		{
			return _fiercelyUpper;
		}

		/**
		 * @private
		 */
		public function set fiercelyUpper(value:CalValue):void
		{
			_fiercelyUpper = value;
		}

		/**
		 * 护甲防护率
		 */
		public function get armorRate():CalValue
		{
			return _armorRate;
		}

		/**
		 * @private
		 */
		public function set armorRate(value:CalValue):void
		{
			_armorRate = value;
		}

		public function get level():uint
		{
			return _level;
		}

		public function set level(value:uint):void
		{
			_level = value;
		}


		private var _actor:Actor;
		
		private var _level:uint;

	}
}